import { HTTP } from '../utils/httpRequestUtil'
import URL from './api'
export default {
  purProjectLoadByPaging (params, cb) {
    HTTP.post(URL.purProjectLoadByPaging, params).then(function (response) {
      cb(response.data)
    }).catch(function (error) {
      cb(error.response)
    })
  },
  purProjectLoadGet (params, cb) {
    HTTP.post(URL.purProjectLoadGet, params).then(function (response) {
      cb(response.data)
    }).catch(function (error) {
      cb(error.response)
    })
  },
  purProjectSave (params, cb) {
    HTTP.post(URL.purProjectSave, params).then(function (response) {
      cb(response.data)
    }).catch(function (error) {
      cb(error.response)
    })
  },
  purProjectDelete (params, cb) {
    HTTP.post(URL.purProjectDelete, params).then(function (response) {
      cb(response.data)
    }).catch(function (error) {
      cb(error.response)
    })
  },
  purProjectExport (params, cb) {
    HTTP.post(URL.purProjectExport, params).then(function (response) {
      cb(response.data)
    }).catch(function (error) {
      cb(error.response)
    })
  },
  purContractLoadByPaging (params, cb) {
    HTTP.post(URL.purContractLoadByPaging, params).then(function (response) {
      cb(response.data)
    }).catch(function (error) {
      cb(error.response)
    })
  },
  purContractLoadGet (params, cb) {
    HTTP.post(URL.purContractLoadGet, params).then(function (response) {
      cb(response.data)
    }).catch(function (error) {
      cb(error.response)
    })
  },
  purContractSave (params, cb) {
    HTTP.post(URL.purContractSave, params).then(function (response) {
      cb(response.data)
    }).catch(function (error) {
      cb(error.response)
    })
  },
  purContractDelete (params, cb) {
    HTTP.post(URL.purContractDelete, params).then(function (response) {
      cb(response.data)
    }).catch(function (error) {
      cb(error.response)
    })
  },
  purContractExport (params, cb) {
    HTTP.post(URL.purContractExport, params).then(function (response) {
      cb(response.data)
    }).catch(function (error) {
      cb(error.response)
    })
  },
  purContractItemLoadByPaging (params, cb) {
    HTTP.post(URL.purContractItemLoadByPaging, params).then(function (response) {
      cb(response.data)
    }).catch(function (error) {
      cb(error.response)
    })
  },
  purContractItemLoadGet (params, cb) {
    HTTP.post(URL.purContractItemLoadGet, params).then(function (response) {
      cb(response.data)
    }).catch(function (error) {
      cb(error.response)
    })
  },
  purContractItemSave (params, cb) {
    HTTP.post(URL.purContractItemSave, params).then(function (response) {
      cb(response.data)
    }).catch(function (error) {
      cb(error.response)
    })
  },
  purContractItemDelete (params, cb) {
    HTTP.post(URL.purContractItemDelete, params).then(function (response) {
      cb(response.data)
    }).catch(function (error) {
      cb(error.response)
    })
  },
  purContractItemExport (params, cb) {
    HTTP.post(URL.purContractItemExport, params).then(function (response) {
      cb(response.data)
    }).catch(function (error) {
      cb(error.response)
    })
  },
  purContractItemProcessSave (params, cb) {
    HTTP.post(URL.purContractItemProcessSave, params).then(function (response) {
      cb(response.data)
    }).catch(function (error) {
      cb(error.response)
    })
  },
  getActivityBusinessInfo (params, cb) {
    HTTP.post(URL.getActivityBusinessInfo, params).then(function (response) {
      cb(response.data)
    }).catch(function (error) {
      cb(error.response)
    })
  },
  purSubmitProcess (params, cb) {
    HTTP.post(URL.purSubmitProcess, params).then(function (response) {
      cb(response.data)
    }).catch(function (error) {
      cb(error.response)
    })
  },
  purContractItemProcessDel (params, cb) {
    HTTP.post(URL.purContractItemProcessDel, params).then(function (response) {
      cb(response.data)
    }).catch(function (error) {
      cb(error.response)
    })
  },
  purChangeProcessSave (params, cb) {
    HTTP.post(URL.purChangeProcessSave, params).then(function (response) {
      cb(response.data)
    }).catch(function (error) {
      cb(error.response)
    })
  },
  purChangeProcessGet (params, cb) {
    HTTP.post(URL.purChangeProcessGet, params).then(function (response) {
      cb(response.data)
    }).catch(function (error) {
      cb(error.response)
    })
  },
  purChangeProcessSubmit (params, cb) {
    HTTP.post(URL.purChangeProcessSubmit, params).then(function (response) {
      cb(response.data)
    }).catch(function (error) {
      cb(error.response)
    })
  },
  purCloseProcessSave (params, cb) {
    HTTP.post(URL.purCloseProcessSave, params).then(function (response) {
      cb(response.data)
    }).catch(function (error) {
      cb(error.response)
    })
  },
  purCloseProcessGet (params, cb) {
    HTTP.post(URL.purCloseProcessGet, params).then(function (response) {
      cb(response.data)
    }).catch(function (error) {
      cb(error.response)
    })
  },
  purCloseProcessSubmit (params, cb) {
    HTTP.post(URL.purCloseProcessSubmit, params).then(function (response) {
      cb(response.data)
    }).catch(function (error) {
      cb(error.response)
    })
  },
  purNonContractProcessSave (params, cb) {
    HTTP.post(URL.purNonContractProcessSave, params).then(function (response) {
      cb(response.data)
    }).catch(function (error) {
      cb(error.response)
    })
  },
  purNonContractProcessGet (params, cb) {
    HTTP.post(URL.purNonContractProcessGet, params).then(function (response) {
      cb(response.data)
    }).catch(function (error) {
      cb(error.response)
    })
  },
  purNonContractProcessSubmit (params, cb) {
    HTTP.post(URL.purNonContractProcessSubmit, params).then(function (response) {
      cb(response.data)
    }).catch(function (error) {
      cb(error.response)
    })
  },
  purProjectImport (fileObj, cb) {
    const formData = new FormData()
    formData.append(fileObj.filename, fileObj.file)
    for (let k in fileObj.param) { // 设置参数
      formData.append(`${k}`, fileObj.param[`${k}`])
    }
    return HTTP.request({
      url: URL.purProjectImport,
      headers: {
        'enctype': 'multipart/form-data',
        'custom-printDebugInfo': 'Y'
      },
      method: 'post',
      data: formData,
    }).then(function (response) {
      cb(response.data)
      // fileObj.onProgress({ percent: 100 })
    }).catch(function (error) {
      cb(error.response)
    })
  },
  purContractImport (fileObj, cb) {
    const formData = new FormData()
    formData.append(fileObj.filename, fileObj.file)
    for (let k in fileObj.param) { // 设置参数
      formData.append(`${k}`, fileObj.param[`${k}`])
    }
    return HTTP.request({
      url: URL.purContractImport,
      headers: {
        'enctype': 'multipart/form-data',
        'custom-printDebugInfo': 'Y'
      },
      method: 'post',
      data: formData,
    }).then(function (response) {
      cb(response.data)
      // fileObj.onProgress({ percent: 100 })
    }).catch(function (error) {
      cb(error.response)
    })
  },
  purContractItemImport (fileObj, cb) {
    const formData = new FormData()
    formData.append(fileObj.filename, fileObj.file)
    for (let k in fileObj.param) { // 设置参数
      formData.append(`${k}`, fileObj.param[`${k}`])
    }
    return HTTP.request({
      url: URL.purContractItemImport,
      headers: {
        'enctype': 'multipart/form-data',
        'custom-printDebugInfo': 'Y'
      },
      method: 'post',
      data: formData,
    }).then(function (response) {
      cb(response.data)
      // fileObj.onProgress({ percent: 100 })
    }).catch(function (error) {
      cb(error.response)
    })
  },
  queryPurchaseDemandLoadByPaging (params, cb) {
    HTTP.post(URL.queryPurchaseDemandLoadByPaging, params).then(function (response) {
      cb(response.data)
    }).catch(function (error) {
      cb(error.response)
    })
  },
  queryCloseDemandLoadByPaging (params, cb) {
    HTTP.post(URL.queryCloseDemandLoadByPaging, params).then(function (response) {
      cb(response.data)
    }).catch(function (error) {
      cb(error.response)
    })
  },
  purTrackPlanLoadByPaging (params, cb) {
    HTTP.post(URL.purTrackPlanLoadByPaging, params).then(function (response) {
      cb(response.data)
    }).catch(function (error) {
      cb(error.response)
    })
  },
  purTrackPlanUpdateStatus (params, cb) {
    HTTP.post(URL.purTrackPlanUpdateStatus, params).then(function (response) {
      cb(response.data)
    }).catch(function (error) {
      cb(error.response)
    })
  },
  // 论文草稿删除
  deleteDraftPaper (params, cb) {
    HTTP.post(URL.deleteDraftPaper, params).then(function (response) {
      cb(response.data)
    }).catch(function (error) {
      cb(error.response)
    })
  },

  // 能力建设计划草稿删除
  deleteDraftCapacityBuildingPlan (params, cb) {
    HTTP.post(URL.deleteDraftCapacityBuildingPlan, params).then(function (response) {
      cb(response.data)
    }).catch(function (error) {
      cb(error.response)
    })
  },
  // 能建建设阶段进展流程-删除草稿
  deleteDraftCapacityBuildingProcess (params, cb) {
    HTTP.post(URL.deleteDraftCapacityBuildingProcess, params).then(function (response) {
      cb(response.data)
    }).catch(function (error) {
      cb(error.response)
    })
  },
  // 实验室计划-删除草稿
  deleteDraftLaboratoryAnnualPlan (params, cb) {
    HTTP.post(URL.deleteDraftLaboratoryAnnualPlan, params).then(function (response) {
      cb(response.data)
    }).catch(function (error) {
      cb(error.response)
    })
  },
  // 实验室阶段进展流程-删除草稿
  deleteDraftLaboratoryAnnualProcess (params, cb) {
    HTTP.post(URL.deleteDraftLaboratoryAnnualProcess, params).then(function (response) {
      cb(response.data)
    }).catch(function (error) {
      cb(error.response)
    })
  },
  // 预算申请-删除草稿
  deleteDraftBudget (params, cb) {
    HTTP.post(URL.deleteDraftBudget, params).then(function (response) {
      cb(response.data)
    }).catch(function (error) {
      cb(error.response)
    })
  },
  // 人资调配流程-删除草稿
  deleteDraftHr (params, cb) {
    HTTP.post(URL.deleteDraftHr, params).then(function (response) {
      cb(response.data)
    }).catch(function (error) {
      cb(error.response)
    })
  }
  
}
